Skip to content

Fix SYSTEC error lookup for ctypes result codes - #2095

Open
timothyanderson096-ocdealcheck wants to merge 2 commits into
hardbyte:mainfrom
timothyanderson096-ocdealcheck:fix-systec-2077
Open

Fix SYSTEC error lookup for ctypes result codes#2095
timothyanderson096-ocdealcheck wants to merge 2 commits into
hardbyte:mainfrom
timothyanderson096-ocdealcheck:fix-systec-2077

Conversation

@timothyanderson096-ocdealcheck

Copy link
Copy Markdown

Summary

Normalize SYSTEC ctypes return codes through .value before looking them up in the error-message mapping.

UcanException currently uses the ctypes.c_ubyte result object itself as a dictionary key. ctypes scalar values are unhashable, so error handling can raise TypeError: unhashable type and hide the original CAN error.

This change:

  • looks up the message using result.value
  • preserves the existing numeric error_code
  • adds a regression test proving a c_ubyte SYSTEC return code produces the underlying diagnostic instead of a TypeError

Fixes #2077.

@mergify

mergify Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unhashable type for Systec interface errors

1 participant